﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Com.DA;
using Com.BU;

namespace Com
{
    /// <summary>
    /// Interaction logic for ucAirSpace.xaml
    /// </summary>
    public partial class ucAirSpace : UserControl
    {
        public ucAirSpace()
        {
            this.InitializeComponent();
            loadData();
            enableButtons();
        }

        private void loadData()
        {
            cbxDescription.Items.Clear();
            LibraryManagerInCom.loadAirConditionPlace();
            foreach (var item in LibraryManagerInCom.AirConditionPlaceList)
            {
                cbxDescription.Items.Add(item);
            }
            cbxDescription.DisplayMemberPath = "description";
            cbxDescription.SelectedIndex = 0;
        }

        private void enableButtons()
        {
            btnCancel.IsEnabled = false;
            btnSave.IsEnabled = false;

            btnNew.IsEnabled = true;
            btnCopy.IsEnabled = true;
            btnDelete.IsEnabled = true;
        }

        private void disableButtons()
        {
            btnCancel.IsEnabled = true;
            btnSave.IsEnabled = true;

            btnNew.IsEnabled = false;
            btnCopy.IsEnabled = false;
            btnDelete.IsEnabled = false;
        }

        private void cbxDescription_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cbxDescription.SelectedItem != null)
            {
                tb_air_conditioning_place ac = (tb_air_conditioning_place)cbxDescription.SelectedItem;
                txtDensity.Text = ac.people_density.ToString();
                txtAirAmount.Text = ac.air_amount_per_perople.ToString();
                txtPeopleImpact.Text = ac.impact_people.ToString(); ;
                txtLightingImpact.Text = ac.impact_lighting.ToString();
            }
            
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnNew_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnCopy_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {

        }

    }


}